﻿
Imports drawing.CommonInterfaces.UI.interfaces

Namespace bozo
    Public Class Beacon
        Implements IShape, ISelectable, IClickable, IViewable, ITickable



        Dim img As Image
        Dim hovered As Boolean = False
        Dim _selected As Boolean = False
        Dim position As Point
        Dim redPen As New Pen(Color.Red, 3)
        Dim bluePen As New Pen(Color.Blue, 3)
        Dim _id As Double


        Public Sub New(ByVal p As Point)
            position = p
            img = My.Resources.beacon

        End Sub


        Public Sub hover() Implements CommonInterfaces.UI.interfaces.IClickable.hover
            hovered = True
        End Sub

        Public Sub normal() Implements CommonInterfaces.UI.interfaces.IClickable.normal
            hovered = False
        End Sub

        Public Sub onClick() Implements CommonInterfaces.UI.interfaces.IClickable.onClick

        End Sub

        Public Property selected() As Boolean Implements CommonInterfaces.UI.interfaces.ISelectable.selected
            Get
                Return _selected
            End Get
            Set(ByVal value As Boolean)
                _selected = value
            End Set
        End Property

        Public Function getClippingRcangle() As System.Drawing.Rectangle Implements CommonInterfaces.UI.interfaces.IShape.getClippingRcangle
            Return New Rectangle(X, Y, width, height)
        End Function

        Public Property height() As Integer Implements CommonInterfaces.UI.interfaces.IShape.height
            Get
                Return img.Height
            End Get
            Set(ByVal value As Integer)

            End Set
        End Property

        Public Property pen() As System.Drawing.Pen Implements CommonInterfaces.UI.interfaces.IShape.pen
            Get
                Return Nothing
            End Get
            Set(ByVal value As System.Drawing.Pen)

            End Set
        End Property

        Public Property width() As Integer Implements CommonInterfaces.UI.interfaces.IShape.width
            Get
                Return img.Width
            End Get
            Set(ByVal value As Integer)

            End Set
        End Property

        Public Property X() As Integer Implements CommonInterfaces.UI.interfaces.IShape.X
            Get
                Return position.X
            End Get
            Set(ByVal value As Integer)
                position.X = value
            End Set
        End Property

        Public Property Y() As Integer Implements CommonInterfaces.UI.interfaces.IShape.Y
            Get
                Return position.Y
            End Get
            Set(ByVal value As Integer)
                position.Y = value
            End Set
        End Property

        Public Sub draw(ByRef graph As System.Drawing.BufferedGraphics) Implements IViewable.draw
            graph.Graphics.DrawImage(img, position)
            If Not selected Then
                If hovered Then
                    graph.Graphics.DrawRectangle(redPen, X - 4, Y - 4, width + 8, height + 8)
                End If
            Else
                graph.Graphics.DrawRectangle(bluePen, X - 4, Y - 4, width + 8, height + 8)
            End If

        End Sub

        Public Sub resetSize(ByVal size As System.Drawing.Rectangle) Implements IViewable.resetSize

        End Sub

        Public Sub thick() Implements ITickable.tick

        End Sub

        Public Property ID() As Double Implements ITickable.ID
            Get
                Return _id
            End Get
            Set(ByVal value As Double)
                _id = value
            End Set
        End Property
    End Class

End Namespace
